<template>
  <ul class="todo-list">
    <!-- completed: 完成的类名 -->
    <li :class="{completed:obj.isDone}" v-for="(obj,index) in arr" :key="obj.id">
      <div class="view">
        <input v-model="obj.isDone" class="toggle" type="checkbox" />
        <label>{{obj.name}}</label>
        <button @click="delFn(index)" class="destroy"></button>
      </div>
    </li>
  </ul>
  
</template>

<script>
// 4,删除list里的数据
export default {
    // 2.1定义props
    props:["arr"],
    methods:{
        delFn(index){
            // 4.1子传父 
            this.$emit("del",index)
        }
    }
}
</script>